#include "rnd.h"

/**
   initialize random seed
 */
void rnd_init()
{
   // set random seed
   srandom((unsigned int)time(NULL));
}

/**
   pseudo random uniform dist [0,1)
 */
double rnd_uniform()
{
   return (double)random() / RAND_MAX;
}

/**
   pseudo random exp. dist [0, +inf)
 */
double rnd_exp(double rate)
{
   return log( 1 - rnd_uniform() ) / -rate;
}
